import './App.scss'
import Editor from './components/editor'
import data from './data.json'
import registerConfig from './utils/editor-config.js'
import { createContext, useState } from 'react'

const EditorConfigContext = createContext()

function App() {
  const [jsonData, setJsonData] = useState(data)

  const changeData = (newData) => {
    setJsonData(newData)
  }

  return (
    <EditorConfigContext.Provider value={registerConfig}>
      <div className="App">
        <Editor data={jsonData} changeData={changeData} />
      </div>
    </EditorConfigContext.Provider>
  )
}

export default App

export { EditorConfigContext }
